//
//  ClubConversationController.m
//  PaiQuan
//
//  Created by Mac on 16/7/14.
//  Copyright © 2016年 huigu. All rights reserved.
//

#import "ClubConversationController.h"
#import "collateClubViewController.h"
#import "newBuildViewController.h"
#import "PersonalViewController.h"
#import "ClubDetailViewController.h"
#import "JHTitleView.h"
@interface ClubConversationController ()<JHTitleViewDelegate>

@end

@implementation ClubConversationController
-(instancetype)init
{
    if (self = [super init])
    {
        [self setupTitleView];
    }
    return self;
}

-(instancetype)initWithCoder:(NSCoder *)aDecoder
{
    if (self = [super initWithCoder:aDecoder])
    {
        [self setupTitleView];
    }
    return self;
}
-(UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent ;
}
- (void)setupTitleView
{
    self.titleView = [[JHTitleView alloc] initWithFrame:CGRectMake(0,0, ScreenW, NaviBarHeight)];
    self.titleView.delegate = self;
    
}
-(void)jhTitleView:(JHTitleView *)titleView clickBackButton:(UIButton *)backbtn
{
    if (self.navigationController.topViewController == self)
    {
        [self.navigationController popViewControllerAnimated:YES];
    }
}

- (void)viewDidLoad {
    [super viewDidLoad];
     self.navigationController.navigationBarHidden = YES;
    [self.view addSubview:self.titleView];
    self.titleView.title = self.title;
    [self.titleView.btnBack setImage:PQIMG(@"back") forState:UIControlStateNormal];
    [self.titleView.btnBack setTitle:@"返回" forState:UIControlStateNormal];
    
    [self.titleView.rightBtn setTitle:@"详情" forState:UIControlStateNormal];
    [self.titleView.rightBtn setTitleColor:PQ_COLOR_YELLOW forState:UIControlStateNormal];
    [self.titleView.rightBtn addTarget:self action:@selector(rightBtnDidClick) forControlEvents:UIControlEventTouchUpInside];

    [self setUPUI];
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    self.navigationController.navigationBar.translucent = NO;
    
    
    }


-(void)setUPUI{
    UIButton * positionBtn = [[UIButton alloc] init];
    [positionBtn setTitle:[NSString stringWithFormat:@"对局：%d",8] forState:UIControlStateNormal];
    [positionBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [positionBtn setBackgroundColor:PQ_COLOR_YELLOW];
    positionBtn.layer.cornerRadius = 6;
    positionBtn.layer.masksToBounds = YES;
    positionBtn.titleLabel.font = FONT(14);
    [self.view addSubview:positionBtn];
    [positionBtn addTarget:self action:@selector(positonBtnDidClick) forControlEvents:UIControlEventTouchUpInside];
    [positionBtn makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.view.top).offset(RATIO(152));
        make.right.equalTo(self.view.right).offset(-RATIO(20));
        make.width.equalTo(RATIO(116));
        make.height.equalTo(RATIO(50));
        
    }];
    
    UIButton * startBtn = [[UIButton alloc] init];
    [startBtn setTitle:@"开局" forState:UIControlStateNormal];
    [startBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [startBtn setBackgroundColor:PQ_COLOR_YELLOW];
    startBtn.layer.cornerRadius = 6;
    startBtn.layer.masksToBounds = YES;
    startBtn.titleLabel.font = FONT(14);
    [self.view addSubview:startBtn];
    [startBtn addTarget:self action:@selector(startBtnDidClick) forControlEvents:UIControlEventTouchUpInside];
    [startBtn makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(positionBtn.bottom).offset(RATIO(24));
        make.right.equalTo(self.view.right).offset(-RATIO(20));
        make.width.equalTo(RATIO(116));
        make.height.equalTo(RATIO(50));
        
    }];
    
    

    
}

-(void)rightBtnDidClick{
    ClubDetailViewController *clubDetailVC = [[ClubDetailViewController alloc] init];
    [self.navigationController pushViewController:clubDetailVC animated:YES];
    
}
-(void)positonBtnDidClick{
    collateClubViewController *collateVC =[[collateClubViewController alloc] init];
    [self.navigationController pushViewController:collateVC  animated:YES];
    
}
-(void)startBtnDidClick{
    newBuildViewController *newbuildVC = [[newBuildViewController alloc] init];
    [self.navigationController pushViewController:newbuildVC animated:YES];
    
    
}
-(void)doBack{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)didTapCellPortrait:(NSString *)userId{
    
    PersonalViewController *personVC = [[PersonalViewController alloc] init];
    [super.navigationController setNavigationBarHidden:NO];

    [self.navigationController pushViewController:personVC animated:YES];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
